<div class="main dangerManagement">
	<bid-tabs
	  query-fn="vm.paginationQuery"
	  query-bean="vm.queryData"
	  query-param="bidId"
	  query-type="bid"></bid-tabs>
	<div class="query-info shadowbox">
		<div class="container-header">危险源信息</div>
		<form class="base-info pa-form-content"
			name="queryForm" novalidate>
			<div class="pa-form-control pa-form-control-inline">
			  <label for="name">过程(区域)：</label>
			  <input type="text"
			    ng-model="vm.queryData.taskName">
			</div>
      <div class="pa-form-control pa-form-control-inline">
        <label for="name">详细位置：</label>
        <input type="text"
          ng-model="vm.queryData.taskName">
      </div>
		</form>
		<div class="btn-outer-right">			
			<a class="pa-btn"
				ng-click="vm.query(queryForm)">
				<i class="fa fa-search"></i>
				<span class="ml5">查询</span>
			</a>
			<a class="pa-btn reset-btn"
				ng-click="vm.reset()">
				<i class="fa fa-repeat"></i>
				<span class="ml5">重置</span>
			</a>		
		</div>
	</div>
	<div class="registration-code">    
	  <a class="pa-btn"
	    ng-click="vm.addDialogForm()">
	    新增危险源
	  </a>
    <a class="pa-btn"
      ng-click="">
      关闭危险源
    </a>
    <a class="pa-btn"
      ng-click="vm.printQrCode()">
      打印二维码
    </a>
	</div>
	<div class="pa-table-container shadowbox">
		<form class="base-info">
			<table class="pa-table">
				<thead>
					<tr>
						<th>
              <input type="checkbox" class="form-control-box" ng-model="vm.topChecked" ng-change="vm.toggleAll()"/>全选      
            </th>
						<th>编号</th>
						<th>过程(区域)</th>
						<th>详细位置</th>
            <th>状态</th>
						<th style="width: 113px;">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="item in vm.dangerManagementList">
            <td>
              <input type="checkbox"
                class="form-control-box"  
                ng-model="item.checked"/>
            </td>
						<td>{{item.id}}</td>
            <td>{{item.area}}</td>
            <td>{{item.address}}</td>
            <td>{{item.status ? '启用中' : '已关闭'}}</td>
						<td>
							<div class="del"
								ng-click="vm.checkDetail(item)">
								<i class="fa fa-street-view color"></i>
								<span>查看</span>									
							</div>
							<div class="del"
								ng-click="vm.deleteDetail($index)">
								<i class="fa fa-trash color"></i>
								<span>删除</span>
							</div>									
						</td>
					</tr>
				</tbody>
			</table>
		</form>
		<div class="total-num">
		  共计<span class="total-num-colorful">
		  {{vm.dangerManagementList.length}}</span>条
		</div>
		<!-- 分页 -->
    <div class="pagination-outer">
      <uib-pagination
        total-items="vm.dangerManagementList.length"
        ng-model="vm.paginationData.pageNum"
        items-per-page="vm.paginationData.pageSize"
        ng-change="pageChange()"
        class="pagination-sm"
        boundary-link-numbers="true"
        max-size="5"
        next-text="下一页"
        previous-text="上一页"></uib-pagination>
    </div>
	</div> 
</div>

<!-- 新增危险源 start -->
<script type="text/ng-template" id="addDangerForm">
  <div class="item-detail-dialog training-tech">  
    <div class="item-detail-dialog-header"> 
      <div class="title-txt">
        <span>新增危险源</span> 
      </div>
    </div>  
    <div class="item-detail-dialog-content">
      <form name="tech" role="form" novalidate>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>过程(区域)：</div> 
          <div class="right-value">
            <input type="text" name="area" required
              ng-model="add.model.area"/>
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>详细位置：</div> 
          <div class="right-value">
            <input type="text" name="address" required
              ng-model="add.model.address" />
          </div> 
        </div>
        <div class="info-title">
          <span class="title-brief">危险源</span>
          <div class="edit-add"
            ng-click="add.addDangerItem()">
            <i class="fa fa-plus"></i>
            <span>新增</span>
          </div>
        </div>
        <table class="pa-table edit">
          <tr>
            <th>名称</th>
            <th>级别</th>
            <th>行为(活动)设备或环境</th>
            <th>潜在危险因素</th>
            <th>可能导致结果</th>
            <th>控制措施</th>
            <th></th>
          </tr>
          <tr ng-repeat="item in add.model.dangerItemList">
            <td>
              <input type="text" ng-model="item.name">
            </td>
            <td>
              <select name="" ng-model="item.grade">
                <option value="A">A</option>
                <option value="B">B</option>
                <option value="C">C</option>
              </select>
            </td>
            <td>
              <input type="text" ng-model="item.behave">
            </td>
            <td>
              <input type="text" ng-model="item.factor">
            </td>
            <td>
              <input type="text" ng-model="item.effect">
            </td>
            <td>
              <input type="text" ng-model="item.prevent">
            </td>
            <td>
              <a href="javascript:;" ng-click="add.deleteItem($index)">删除</a>
            </td>
          </tr>
        </table>
      </form>
    </div> 
    <div class="item-detail-dialog-footer"> 
      <a class="pa-btn" ng-click="add.save()">  
        <i class="fa fa-save"></i>  
        <span class="ml5">确定</span>  
      </a> 
      <a class="pa-btn" ng-click="closeThisDialog()"> 
        <i class="fa fa-times"></i> 
        <span class="ml5">取消</span>
      </a> 
    </div>  
  </div>  
</script>
<!-- 新增危险源 end -->

<script type="text/ng-template" id="dangerDetail">
  <div class="item-detail-dialog training-tech">  
    <div class="item-detail-dialog-header"> 
      <div class="title-txt">
        <span>危险源详情</span> 
      </div>
    </div>  
    <div class="item-detail-dialog-content">
      <form name="tech" role="form" novalidate>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>过程(区域)：</div> 
          <div class="right-value">
            <span>{{detail.model.area}}</span>
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>详细位置：</div> 
          <div class="right-value">
            <span>{{detail.model.address}}</span>
          </div> 
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>状态：</div> 
          <div class="right-value">
            <span>启用中</span>
          </div> 
        </div>
        <div class="info-title">
          <span class="title-brief">危险源</span>
        </div>
        <table class="pa-table edit">
          <tr>
            <th>名称</th>
            <th>级别</th>
            <th>行为(活动)设备或环境</th>
            <th>潜在危险因素</th>
            <th>可能导致结果</th>
            <th>控制措施</th>
          </tr>
          <tr ng-repeat="item in detail.model.dangerItemList">
            <td>
              <span>{{item.name}}</span>
            </td>
            <td>
              <span>{{item.grade}}</span>
            </td>
            <td>
              <span>{{item.behave}}</span>
            </td>
            <td>
              <span>{{item.factor}}</span>
            </td>
            <td>
              <span>{{item.effect}}</span>
            </td>
            <td>
              <span>{{item.prevent}}</span>
            </td>
          </tr>
        </table>
      </form>
    </div> 
    <div class="item-detail-dialog-footer"> 
      <a class="pa-btn" ng-click="add.save()">  
        <i class="fa fa-save"></i>  
        <span class="ml5">确定</span>  
      </a> 
      <a class="pa-btn" ng-click="closeThisDialog()"> 
        <i class="fa fa-times"></i> 
        <span class="ml5">取消</span>
      </a> 
    </div>  
  </div>  
</script>

<script type="text/ng-template" id="dangerManagementQrCode">
  <div class="item-detail-dialog">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>人员信息二维码</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <div class="qr-print-scroll-outer">
        <div class="qr-print" style="width: 300px;">
          <div class="qr-item" style="width: 300px;height: 225px; overflow: hidden; word-wrap: break-word;"
            ng-repeat="item in vm.selectedItems">
            <table class="qr-info" style="width: 100%; height: 100%;">
              <tr>
                <td class="qr-info" style="font-size: 22px;font-weight: 600;text-align: right;">
                  <div style="width: 120px;word-wrap: break-word;padding-right: 6px;">
                    {{::item.area}}
                  </div>
                  <div style="width: 120px;word-wrap: break-word;padding-right: 6px;">
                    {{::item.address}}
                  </div>
                </td>
                <td class="qr-img" style="text-align: center; width: 160px; ">
                  <img style="width:160px; height: 160px; " ng-src="{{vm.getQrCodeSrc(item)}}">
                  <!-- <img style="width:100%;" src="../../../assets/images/apk.png"> -->
                </td>
              </tr>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="vm.print()">
        <i class="fa fa-save"></i>
        <span class="ml5">打印</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>